package hc.bre.clas.branch

import hc.bre.ComponentConfig
import hc.bre.clas.ClasRuleDefinition
import hc.bre.clas.range.RangeOption


@groovy.transform.CompileStatic
@groovy.transform.ToString(includeNames=true,includePackage=false)
class BranchDefinition extends ClasRuleDefinition<RangeOption>{
	public static final ComponentConfig _config ;
	static {
		_config = new ComponentConfig();
		_config.rtype = 'rule:clas:branch';
		_config.rname = '逻辑分支分类';
		_config.builderClass = BranchBuilder;
		_config.resultStruct = new hc.bre.clas.ClasResultStruct();
		_config.objectpage = '/rule/clas/BranchEditor.htm?rpath=${rpath}';
		_config.description = '''基于一段脚本的计算结果，通过计算结果的数值范围，进行多个分支的分类。''';
	}
	
	public static BranchDefinition create() {
		def ruleDef = new BranchDefinition();
		ruleDef.list = [
			new RangeOption().load([id:0,code:'other',name:'其它',range:'{true}',otherflag:1])
		];
		return ruleDef;
	}

	String script ='1';

	@Override
	public BranchDefinition load(Map map) {
		super.load(map);
		script = map['script'];
		return this;
	}
}
